package com.iflytek.universitymanagement.service.impl;

import com.iflytek.universitymanagement.mapper.StatisticsMapper;
import com.iflytek.universitymanagement.service.StatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StatisticsServiceImpl implements StatisticsService {

    @Autowired
    private StatisticsMapper statisticsMapper;

    @Override
    public int getStudentCount() {
        return statisticsMapper.getStudentCount();
    }

    @Override
    public int getCourseCount() {
        return statisticsMapper.getCourseCount();
    }

    @Override
    public int getCompetitionParticipationCount() {
        return statisticsMapper.getCompetitionParticipationCount();
    }

    @Override
    public Double getAverageCompletionRate() {
        Double rate = statisticsMapper.getAverageCompletionRate();
        return rate != null ? rate : 0.0;
    }
}
